import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    children: [
      { path: '/', component: () => import('@/views/home') },
      { path: 'goods', component: () => import('@/views/goods') },
      { path: 'categories', component: () => import('@/views/categories') },
      { path: 'addgoods', component: () => import('@/views/goods/add') },
      { path: 'orders', component: () => import('@/views/orders') },
      { path: 'roles', component: () => import('@/views/roles') },
      { path: 'rights', component: () => import('@/views/rights') },
      { path: 'users', component: () => import('@/views/users') },
      { path: 'reports', component: () => import('@/views/reports') }
    ]
  },
  { path: '/login', component: () => import('@/views/login') },
  {
    path: '*',
    component: () => import('@/layout/index'),
    children: [{
      path: '/',
      component: () => import('@/layout/404/index.vue')
    }]
  }
]

const router = new VueRouter({
  routes
})

export default router
